// Nama			: Bagus Rahman Aryabima
// NIM			: 13509044
// Nama File	: Superblock.h
// Tanggal		: 3 Desember 2011
// Deskripsi	: Representasi Superblock pada 56FS

#ifndef SUPERBLOCK_H
#define SUPERBLOCK_H

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "../bool/bool.h"

typedef struct {
	char *Name;				// Nama File System
	unsigned long Size;		// Ukuran File System
	char Status;			// Status File System: unmounted(0), mounted(1)
	unsigned long BCount;	// Jumlah blok efektif
} Superblock;

void Initialize(Superblock *S);

// ********** Get dan Set biasa **********
char *getName(Superblock S);
unsigned long getSize(Superblock S);
char getStatus(Superblock S);
void setName(Superblock *S, char *newName);
void setSize(Superblock *S, unsigned long newSize);
void setStatus(Superblock *S);

// ********** Get dan Set ke hard drive **********
char *readName(FILE *Stream);
unsigned long readSize(FILE *Stream);
char readStatus(FILE *Stream);
void writeName(FILE *Stream, char *newName);
void writeSize(FILE *Stream, unsigned long newSize);
void writeStatus(FILE *Stream, char newStatus);

#endif
